const { app, BrowserWindow,ipcMain } = require("electron");
const path = require("node:path");
const fs = require('fs')

function witeFile(a,b,c){
console.log(`${__dirname}/hello.txt`,b);
fs.writeFileSync(`${__dirname}/hello.txt`,b)
  console.log(a,b)
}

const createWindow = () => {
  const win = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      preload: path.join(__dirname, "preload.js"),
    },
  });
  ipcMain.on('save-file',witeFile)

  win.loadFile("index.html");
    win.webContents.openDevTools();
};

app.whenReady().then(() => {
  createWindow();
});
